import request from "@/utils/request";


/**
 * 获取时间统计数据
 * @returns {Promise<unknown>}
 */
export function getStatisticsInfo(){
  return request({
    url: '/statistics/getStatisticsInfo',
    method: 'get',
  })
}

/**
 * 获取收入统计的日期维度
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getDateIncome(params = {}){
  return request({
    url: '/statistics/getDateIncome',
    method: 'get',
    params
  })
}

/**
 * 获取收入统计的用户维度
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getUserIncome(params = {}){
  return request({
    url: '/statistics/getUserIncome',
    method: 'get',
    params
  })
}

/**
 * 获取平台维度
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getPlatformStatistics(params = {}){
  return request({
    url: '/statistics/getPlatformStatistics',
    params
  })
}

/**
 * 获取仓储统计
 * @returns {Promise | Promise<unknown>}
 */
export function getStorageStatistics(params = {}){
  return request({
    url: '/statistics/getStorageStatistics',
    method: 'get',
    params
  })
}


/**
 * 获取订单的结算单
 * @param params
 * @returns {Promise<unknown>}
 */
export function getSettleOrderList(params = {}){
  return request({
    url: '/statistics/getSettleOrderList',
    method: 'get',
    params,
  })
}

/**
 * 获取结算单仓储
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getSettleStorageList(params = {}){
  return request({
    url: '/statistics/getSettleStorageList',
    method: 'get',
    params
  })
}

/**
 * 生成结算单
 * @param data
 * @returns {Promise<unknown>}
 */
export function createPayment(data){
  return request({
    url: '/statistics/createPayment',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 获取结算单列表
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getPaymentList(params = {}){
  return request({
    url: '/statistics/getPaymentList',
    method: 'get',
    params
  })
}

/**
 * 标记结算单完成
 * @param id
 * @returns {Promise | Promise<unknown>}
 */
export function finishPayment(id){
  return request({
    url: `/statistics/finishPayment/${id}`,
    method: 'patch',
  })
}

/**
 *
 * @param id
 * @returns {Promise | Promise<unknown>}
 */
export function resetPayment(id){
  return request({
    url: `/statistics/resetPayment/${id}`,
    method: 'patch',
  })
}

/**
 * 删除结算单
 * @param id
 * @returns {Promise | Promise<unknown>}
 */
export function deletePayment(id){
  return request({
    url: `/statistics/deletePayment/${id}`,
    method: 'delete',
  })
}

/**
 * 获取结算单详情
 * @param id
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getPaymentInfo(id, params = {}){
  return request({
    url: `/statistics/getPaymentInfo/${id}`,
    params
  })
}

/**
 * 下载结算单的pdf
 * @param id
 * @returns {Promise | Promise<unknown>}
 */
export function getPaymentPdf(id){
  return request({
    url: `/statistics/getPaymentPdf/${id}`,
    handleError: true,
  })
}

/**
 * 获取送仓工单的数据
 * @param params
 * @returns {Promise<unknown>}
 */
export function getMiddleOrderList(params){
  return request({
    url: `/statistics/getMiddleOrderList`,
    handleError: true,
    params
  })
}


/**
 * 获取调货工单的数据
 * @param params
 * @returns {Promise<unknown>}
 */
export function getTransferOrderList(params){
  return request({
    url: `/statistics/getTransferOrderList`,
    handleError: true,
    params
  })
}

/**
 * 获取贴标工单的数据
 * @param params
 * @returns {Promise<unknown>}
 */
export function getLabelOrderList(params){
  return request({
    url: `/statistics/getLabelOrderList`,
    handleError: true,
    params
  })
}

export function getShipmentList(params){
  return request({
    url: `/statistics/getShipmentList`,
    handleError: true,
    params
  })
}

export function getPaymentOrder(params){
  return request({
    url: `/statistics/getPaymentOrder`,
    params
  })
}

export function getPaymentMiddle(params){
  return request({
    url: `/statistics/getPaymentMiddle`,
    params
  })
}

export function getPaymentTransfer(params){
  return request({
    url: `/statistics/getPaymentTransfer`,
    params
  })
}

export function getPaymentLabel(params){
  return request({
    url: `/statistics/getPaymentLabel`,
    params
  })
}

export function getPaymentShipment(params){
  return request({
    url: `/statistics/getPaymentShipment`,
    params
  })
}
